﻿using System;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for Database
/// </summary>
public class Database
{
    static string connstr;
    static SqlConnection conn;

    private Database() { }

    static Database()
    {
        connstr = "Data Source=WEBTEST;Initial Catalog=DemoGraphics;Integrated Security=SSPI";
    }

    public static SqlConnection Connection
    {
        get {
            if (conn == null)
            {
                conn = new SqlConnection(ConnectionString);
                conn.Open();
            }
            return conn;
        }
    }

    public static string ConnectionString
    {
        get { return connstr; }
        set { connstr = value; conn.Close(); conn = null; }
    }
}
